package com.example.test_event_and_callback.infras.async;

import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class DemanderProcessorReflection extends AsyncDemanderProcessor<Method> {


    public DemanderProcessorReflection(Class<?> demanderClass) {
        init(demanderClass);
    }


    @Override
    Method exchangeMethod(Field field, Method method) {
        return method;
    }

    @Override
    <T extends Demander> void setParam(T dto, String paramName, Object param) throws InvocationTargetException, IllegalAccessException {
        mappedMethods.get(paramName).invoke(((AsyncDemanderProxy)dto).getInstance(), param);
    }
}
